
/*
 ***************************************************************************
 * MediaTeK Inc.
 * 4F, No. 2 Technology	5th	Rd.
 * Science-based Industrial	Park
 * Hsin-chu, Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2012, MTK.
 *
 * All rights reserved.	MediaTeK's source	code is	an unpublished work	and	the
 * use of a	copyright notice does not imply	otherwise. This	source code
 * contains	confidential trade secret material of MediaTeK Tech. Any attemp
 * or participation	in deciphering,	decoding, reverse engineering or in	any
 * way altering	the	source code	is stricitly prohibited, unless	the	prior
 * written consent of MediaTeK, Inc. is obtained.
 ***************************************************************************

	Module Name:
	omci_me_general_purpose_func.c
	
	Abstract:

	Revision History:
	Who			When			What
	--------	----------		----------------------------------------------
	Name		Date			Modification logs
	kenny.weng		2012/7/16	Create
        Andy.Yi                 2012/7/27       add the 9.12.1-11 me node
*/

#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "omci_adpt_common.h"
#include "omci_adpt_general.h"
#include "libcompileoption.h"

typedef struct __fileTransferType
{
	uint8_t *localFileName;
	uint8_t fileType;
	uint8_t *networkAddress;
}fileTransferType;

fileTransferType fileTransferMng;

static int setFileTypeValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr);
static int setFileInstanceValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr);
static int setLocalFileNameValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr);
static int setNetworkAddressValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr);
static int setFileTransferTriggerValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr);

/*******************************************************************************************************************************
9.12.1 UNI-G

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_uni_g_op[]={
	{0, "meId" , 					2,  ATTR_ACCESS_R,        ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{1, "Deprecated" , 				2,  ATTR_ACCESS_R_W,      ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{2, "Administrative state", 	1,  ATTR_ACCESS_R_W ,     ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{3, "Management capability",	1,  ATTR_ACCESS_R,        ATTR_FORMAT_ENUM,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{4, "Non-OMCI manageid",		2,  ATTR_ACCESS_R_W,      ATTR_FORMAT_POINTER,        ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{5, "Relay Agent Options",		2,  ATTR_ACCESS_R_W,      ATTR_FORMAT_POINTER,        ATTR_UNSUPPORT,&generalAttrFunc},
	{255, "" , 						0, 	0, 	0, 	0, 		NULL}
};

omci_me_func_t omci_me_uni_g_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_uni_g_t omci_uni_g_attr_data = {0};

omci_attr_t omci_uni_g_attr ={
	(uint8_t *)&omci_uni_g_attr_data,
	sizeof(omci_uni_g_attr_data)
};

/*******************************************************************************************************************************
9.12.2 OLT-G

********************************************************************************************************************************/

static attribute_func_t OLTVendorIdFunc = {
	NULL,
	setOLTVendorIdValue
};
static attribute_func_t OLTEquipmentIdFunc = {
	NULL,
	setOLTEquipmentIdValue
};
static attribute_func_t OLTVersionFunc = {
	NULL,
	setOLTVersionValue
};
static attribute_func_t TimeOfDayFunc = {
	getTimeOfDayValue,
	setTimeOfDayValue
};

omci_attr_dscp_t omci_attr_olt_g_op[]={
	{0, "meId" , 				2 ,     ATTR_ACCESS_R,      ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{1, "OLT vendor id" , 		4 ,     ATTR_ACCESS_R_W,    ATTR_FORMAT_STRING,   		 ATTR_FULLY_SUPPORT, &OLTVendorIdFunc},
	{2, "Equipment id", 		20 ,    ATTR_ACCESS_R_W ,   ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &OLTEquipmentIdFunc},
	{3, "Version",				14,     ATTR_ACCESS_R_W,    ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &OLTVersionFunc},
	{4, "Time of day",			14,     ATTR_ACCESS_R_W,    ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &TimeOfDayFunc},
	{255, "" , 					0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_olt_g_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_olt_g_t omci_olt_g_attr_data = {0};

omci_attr_t omci_olt_g_attr ={
	(uint8_t *)&omci_olt_g_attr_data,
	sizeof(omci_olt_g_attr_data)
};
/*******************************************************************************************************************************
9.12.3 Network address 

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_network_addr_op[]={
	{0, "meId" , 				2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{1, "Security pointer" , 	2 ,     ATTR_ACCESS_R_W_SET_CREATE ,    ATTR_FORMAT_POINTER,         ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{2, "Address pointer" , 	2 ,     ATTR_ACCESS_R_W_SET_CREATE ,    ATTR_FORMAT_POINTER,         ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{255, "" , 					0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_network_addr_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_network_address_t omci_network_addr_attr_data = {0};

omci_attr_t omci_network_addr_attr ={
	(uint8_t *)&omci_network_addr_attr_data,
	sizeof(omci_network_addr_attr_data)
};


/*******************************************************************************************************************************
9.12.4 Authentication security method 

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_auth_sec_method_op[]={
 	{0, "meId" , 				2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{1, "Validation scheme" ,	1 ,     ATTR_ACCESS_R_W,                ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{2, "Username 1" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{3, "Password" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{4, "Realm" , 				25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{5, "Username 2" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
	{255, "" , 					0 , 	0 , 0 , 0 , NULL}
};

omci_me_func_t omci_me_auth_sec_method_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_auth_security_method_t omci_auth_sec_method_attr_data = {0};

omci_attr_t omci_auth_sec_method_attr ={
	(uint8_t *)&omci_auth_sec_method_attr_data,
	sizeof(omci_auth_sec_method_attr_data)
};

/*******************************************************************************************************************************
9.12.5 Large string 

********************************************************************************************************************************/
static attribute_func_t largeStringGetSetFunc = {
	NULL,
	setLargeStringValue
};


omci_attr_dscp_t omci_attr_large_string_op[]={
{0, "meId" , 			2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "Number of parts" , 1 ,     ATTR_ACCESS_R_W,                ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
{2, "Part 1" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{3, "Part 2" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{4, "Part 3" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{5, "Part 4" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{6, "Part 5" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{7, "Part 6" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{8, "Part 7" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{9, "Part 8" , 			25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{10, "Part 9" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{11, "Part 10" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{12, "Part 11" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{13, "Part 12" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{14, "Part 13" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{15, "Part 14" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{16, "Part 15" , 		25 ,    ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT,&largeStringGetSetFunc},
{255, "" , 				0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_large_string_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_large_string_t omci_large_string_attr_data = {0};

omci_attr_t omci_large_string_attr ={
	(uint8_t *)&omci_large_string_attr_data,
	sizeof(omci_large_string_attr_data)
};

/*******************************************************************************************************************************
9.12.6 Threshold data 1

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_thd_data1_op[]={
 	{0, "meId" , 				2,  ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{1, "Threshold value 1",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{2, "Threshold value 2",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{3, "Threshold value 3",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{4, "Threshold value 4",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{5, "Threshold value 5",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{6, "Threshold value 6",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{7, "Threshold value 7",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
 	{255, "" , 					0,	0,	0,	0,		NULL}
};

omci_me_func_t omci_me_thd_data1_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_threshold_data_1_t omci_thd_data1_attr_data = {0};

omci_attr_t omci_thd_data1_attr ={
	(uint8_t *)&omci_thd_data1_attr_data,
	sizeof(omci_thd_data1_attr_data)
};

/*******************************************************************************************************************************
9.12.7 Threshold data 2

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_thd_data2_op[]={
 	{0, "meId" , 				2,  ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{1, "Threshold value 8",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{2, "Threshold value 9",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{3, "Threshold value 10",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{4, "Threshold value 11",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{5, "Threshold value 12",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{6, "Threshold value 13",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{7, "Threshold value 14",	4,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{255, "" , 					0,	0,	0,	0,		NULL}
};

omci_me_func_t omci_me_thd_data2_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_threshold_data_2_t omci_thd_data2_attr_data = {0};

omci_attr_t omci_thd_data2_attr ={
	(uint8_t *)&omci_thd_data2_attr_data,
	sizeof(omci_thd_data2_attr_data)
};

/*******************************************************************************************************************************
9.12.7 Threshold data 2

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_thd_data_64bit_op[]={
 	{0, "meId" , 				2,  ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{1, "Threshold value 8",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{2, "Threshold value 9",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{3, "Threshold value 10",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{4, "Threshold value 11",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{5, "Threshold value 12",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{6, "Threshold value 13",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{7, "Threshold value 14",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{8, "Threshold value 8",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{9, "Threshold value 9",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{10, "Threshold value 10",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{11, "Threshold value 11",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{12, "Threshold value 12",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{13, "Threshold value 13",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{14, "Threshold value 14",	8,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
 	{255, "" , 					0,	0,	0,	0,		NULL}
};

omci_me_func_t omci_me_thd_data_64bit_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_threshold_data_64bit_t omci_thd_data_64bit_attr_data = {0};

omci_attr_t omci_thd_data_64bit_attr ={
	(uint8_t *)&omci_thd_data_64bit_attr_data,
	sizeof(omci_thd_data_64bit_attr_data)
};


/*******************************************************************************************************************************
9.12.8 OMCI

********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_omci_op[]={
{0, "meId" , 				2,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "ME type table",		2,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,            ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{2, "Message type table",	1,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,            ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{255, "" , 					0 ,	0 ,0 ,0 ,NULL}
};

omci_me_func_t omci_me_omci_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_omci_t omci_omci_attr_data = {0};

omci_attr_t omci_omci_attr ={
	(uint8_t *)&omci_omci_attr_data,
	sizeof(omci_omci_attr_data)
};

/*******************************************************************************************************************************
9.12.9 Managed entity

********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_managed_entity_op[]={
{0, "meId" , 				2,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "Name" , 				25, ATTR_ACCESS_R,  ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
{2, "Attributes table" , 	2,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{3, "Access", 				1,  ATTR_ACCESS_R,  ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,&generalAttrFunc},
{4, "Alarms table", 		1,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{5, "AVCs table", 			1,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{6, "Actions", 				4,  ATTR_ACCESS_R,  ATTR_FORMAT_BIT_FIELD,       ATTR_FULLY_SUPPORT,&generalAttrFunc},
{7, "Instances table", 		2,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{8, "Support", 				1,  ATTR_ACCESS_R,  ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,&generalAttrFunc},
{255, "" , 					0, 	0, 	0, 	0, 		NULL}
};

omci_me_func_t omci_me_managed_entity_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_managed_entity_t omci_managed_entity_attr_data = {0};

omci_attr_t omci_managed_entity_attr ={
	(uint8_t *)&omci_managed_entity_attr_data,
	sizeof(omci_managed_entity_attr_data)
};

/*******************************************************************************************************************************
9.12.10 Attribute
This managed entity describes a particular attribute type that is supported by the ONU. This ME is 
not included in MIB upload. 
Relationships 
	One or more attribute entities are related to each ME entity. More than one ME entity can 
	refer to a given attribute entity. 
********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_attribute_op[]={
{0, "meId" , 				2,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "Name" , 				25, ATTR_ACCESS_R,  ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{2, "Size" , 				2,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{3, "Access", 				1,  ATTR_ACCESS_R,  ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,&generalAttrFunc},
{4, "Format", 				1,  ATTR_ACCESS_R,  ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,&generalAttrFunc},
{5, "Lower limit" , 		4,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{6, "Upper limit" , 		4,  ATTR_ACCESS_R,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{7, "Bit field", 			4,  ATTR_ACCESS_R,  ATTR_FORMAT_BIT_FIELD,       ATTR_FULLY_SUPPORT,&generalAttrFunc},
{8, "Code points table", 	2,  ATTR_ACCESS_R,  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{9, "Support", 				1,  ATTR_ACCESS_R,  ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,&generalAttrFunc},
{255, "" , 					0 ,	0 ,	0 ,	0 ,		NULL}
};

omci_me_func_t omci_me_attribute_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_attribute_t omci_attribute_attr_data = {0};

omci_attr_t omci_attribute_attr ={
	(uint8_t *)&omci_attribute_attr_data,
	sizeof(omci_attribute_attr_data)
};

/*******************************************************************************************************************************
9.12.11 Octet string 

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_octet_string_op[]={
	{0, "meId" , 		2 ,     ATTR_ACCESS_R_SET_CREATE,  ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{1, "Length" , 		2 ,     ATTR_ACCESS_R_W,           ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{2, "Part 1" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{3, "Part 2" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{4, "Part 3" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{5, "Part 4" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{6, "Part 5" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{7, "Part 6" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{8, "Part 7" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{9, "Part 8" , 		25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{10, "Part 9" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{11, "Part 10" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{12, "Part 11" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{13, "Part 12" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{14, "Part 13" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{15, "Part 14" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{16, "Part 15" , 	25 ,    ATTR_ACCESS_R_W,           ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT, &generalAttrFunc},
	{255, "" , 			0 ,0 ,0 ,	0 ,		 NULL}
};

omci_me_func_t omci_me_octet_string_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_octet_string_t omci_octet_string_attr_data = {0};

omci_attr_t omci_octet_string_attr ={
	(uint8_t *)&omci_octet_string_attr_data,
	sizeof(omci_octet_string_attr_data)
};

/*******************************************************************************************************************************
9.12.12 General purpose buffer 

********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_general_purpose_buf_op[]={
{0, "meId" , 			2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "Maximum size" , 	4 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{2, "Buffer Table" , 	1 ,     ATTR_ACCESS_R,                  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&generalAttrFunc},
{255, "" , 				0 , 	0 ,0 ,0 ,NULL}
};

omci_me_func_t omci_me_general_purpose_buf_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_general_purpose_buf_t omci_general_purpose_buf_attr_data = {0};

omci_attr_t omci_general_purpose_buf_attr ={
	(uint8_t *)&omci_general_purpose_buf_attr_data,
	sizeof(omci_general_purpose_buf_attr_data)
};

/*******************************************************************************************************************************
9.12.13 File transfer controller 

********************************************************************************************************************************/
/*me code points define*/
static attribute_func_t FileTypeFunc = {
	NULL,
	setFileTypeValue,
};
static attribute_func_t FileInstanceFunc = {
	NULL,
	setFileInstanceValue,
};
static attribute_func_t LocalFileNameFunc = {
	NULL,
	setLocalFileNameValue,
};
static attribute_func_t NetworkAddressFunc = {
	NULL,
	setNetworkAddressValue,
};
static attribute_func_t FileTransferTriggerFunc = {
	NULL,
	setFileTransferTriggerValue,
};


omci_attr_dscp_t omci_attr_file_transfer_ctrl_op[]={
{0, "meId" , 					2 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "Transfer protocols",		2 ,     ATTR_ACCESS_R,          ATTR_FORMAT_BIT_FIELD,       ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{2, "File type" , 				2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&FileTypeFunc},
{3, "File instance" , 			2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&FileInstanceFunc},
{4, "Local file name" , 		2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_POINTER,         ATTR_FULLY_SUPPORT,	&LocalFileNameFunc},
{5, "Network address" , 		2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_POINTER,         ATTR_FULLY_SUPPORT,	&NetworkAddressFunc},
{6, "File transfer trigger" , 	1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,	&FileTransferTriggerFunc},
{7, "File transfer status" , 	1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{8, "GEM IWTP pointer" , 		2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_UNSUPPORT,		&generalAttrFunc},
{9, "VLAN" , 					2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_UNSUPPORT,		&generalAttrFunc},
{10, "File size" , 				4 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_UNSUPPORT,		&generalAttrFunc},
{11, "Directory listing" , 		1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_TABLE,           ATTR_UNSUPPORT,		&generalAttrFunc},
{255, "" , 						0 ,		0 ,	0 ,	0 ,	NULL}
};


omci_me_func_t omci_me_file_transfer_ctrl_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_file_transfer_ctrl_t omci_file_transfer_ctrl_attr_data = {0};

omci_attr_t omci_file_transfer_ctrl_attr ={
	(uint8_t *)&omci_file_transfer_ctrl_attr_data,
	sizeof(omci_file_transfer_ctrl_attr_data)
};

/*******************************************************************************************************************************
9.13.1 physical Path termination Pointer Video UNI

********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_pptp_video_uni_op[]={
{0, "meId" , 					2 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "Adminstrative State",		1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{2, "operational State" , 		1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{3, "ARC" , 			        1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{4, "ARC Interval" , 		    1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{5, "Power Control" , 		    1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{255, "" , 						0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_pptp_video_uni_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_pptp_video_uni_t omci_pptp_video_uni_attr_data = {0};

omci_attr_t omci_pptp_video_uni_attr ={
	(uint8_t *)&omci_pptp_video_uni_attr_data,
	sizeof(omci_pptp_video_uni_attr_data)
};

/*******************************************************************************************************************************
9.13.2 physical Path termination Pointer Video ANI

********************************************************************************************************************************/

omci_attr_dscp_t omci_attr_pptp_video_ani_op[]={
{0, "meId" , 					            2 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "Adminstrative State",		            1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{2, "operational State" , 		            1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{3, "ARC" , 			                    1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{4, "ARC Interval" , 		                1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{5, "Frequency Range Low",                  1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{6, "Frequency Range High" ,                1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{7, "Signal Capbility" ,                    1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{8, "Optical Signal Level" ,                1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{9, "Pilot Signal Level",                   1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{10, "Signal Level Min" ,                   1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{11, "Signal Level Max" ,                   1 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{12, "Pilot Frequency" ,                    4 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{13, "AGC Mode",                            1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{14, "AGC Setting" ,                        1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{15, "Video Lower Optical Threshold" ,      1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},
{16, "Video Higher Optical Threshold" ,     1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,    &generalAttrFunc},

{255, "" , 						0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_pptp_video_ani_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_pptp_video_ani_t omci_pptp_video_ani_attr_data = {0};

omci_attr_t omci_pptp_video_ani_attr ={
	(uint8_t *)&omci_pptp_video_ani_attr_data,
	sizeof(omci_pptp_video_ani_attr_data)
};

/*******************************************************************************************************************************
9.12.14 Generic status portal 

********************************************************************************************************************************/
static attribute_func_t StatusDocumentFunc = {
	getStatusDocumentValue,
	NULL
};
static attribute_func_t ConfugurationdocumentFunc = {
	getConfugurationdocumentValue,
	NULL
};
static attribute_func_t AVCReportRateFunc = {
	NULL,
	setAVCReportRateValue
};

omci_attr_dscp_t omci_attr_generic_stat_portal_op[]={
{0, "meId" , 					2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "Status document" , 		1,      ATTR_ACCESS_R,                  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&StatusDocumentFunc},
{2, "Configuration document",	1 ,     ATTR_ACCESS_R,                  ATTR_FORMAT_TABLE,           ATTR_FULLY_SUPPORT,&ConfugurationdocumentFunc},
{3, "AVC report rate" , 		1 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,&AVCReportRateFunc},
{255, "" ,						0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_generic_stat_portal_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_generic_stat_portal_t omci_generic_stat_portal_attr_data = {0};

omci_attr_t omci_generic_stat_portal_attr ={
	(uint8_t *)&omci_generic_stat_portal_attr_data,
	sizeof(omci_generic_stat_portal_attr_data)
};

#if defined(TCSUPPORT_SNMP)&&(!defined(BSP_BUILD))
/*******************************************************************************************************************************
9.12.15 SNMP config data 

********************************************************************************************************************************/
static attribute_func_t snmpReadCommunityGetSetFunc = {
	NULL,
	setSnmpReadCommunityValue,
};
static attribute_func_t snmpWriteCommunityGetSetFunc = {
	NULL,
	setSnmpWriteCommunityValue,
};
static attribute_func_t snmpSysNameGetSetFunc = {
	NULL,
	setSnmpSysNameValue,
};

omci_attr_dscp_t omci_attr_snmp_cfg_data_op[]={
{0, "meId" , 					2 ,     ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
{1, "SNMP version" , 			2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
{2, "SNMP agent address",		2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
{3, "SNMP server address",		4 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
{4, "SNMP server port",			2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,     ATTR_FULLY_SUPPORT,&generalAttrFunc},
{5, "Security name pointer",	2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&generalAttrFunc},
{6, "Community for read",		2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&snmpReadCommunityGetSetFunc},
{7, "Community for write",		2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&snmpWriteCommunityGetSetFunc},
{8, "Sys name pointer",			2 ,     ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_POINTER,          ATTR_FULLY_SUPPORT,&snmpSysNameGetSetFunc},
{255, "" , 						0 ,		0 ,	0 ,	0 ,	NULL}
};


omci_me_func_t omci_me_snmp_cfg_data_op ={
	omci_me_snmp_cfg_data_create_op,
	omci_me_snmp_cfg_data_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_snmp_cfg_data_t omci_snmp_cfg_data_attr_data = {0};

omci_attr_t omci_snmp_cfg_data_attr ={
	(uint8_t *)&omci_snmp_cfg_data_attr_data,
	sizeof(omci_snmp_cfg_data_attr_data)
};

#endif

/*******************************************************************************************************************************
9.12.16 TR-069 management server 

********************************************************************************************************************************/
static attribute_func_t tr069ManageAdminGetSetFunc = {
	getTr069ManageAdmin,
	setTr069ManageAdmin,
};

static attribute_func_t tr069ACSAddrGetSetFunc = {
	NULL,
	setTr069AcsAddr,
};

static attribute_func_t tr069AssociatedTagGetSetFunc = {
	NULL,
	setTr069AssociateTag,
};

omci_attr_dscp_t omci_attr_tr69_manage_srv_op[]={
{0, "meId" , 				2 ,     ATTR_ACCESS_R,          ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "Administrative" , 		1 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&tr069ManageAdminGetSetFunc},
{2, "ACS network address",	2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_POINTER,         ATTR_FULLY_SUPPORT,	&tr069ACSAddrGetSetFunc},
{3, "Associated tag",		2 ,     ATTR_ACCESS_R_W,        ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&tr069AssociatedTagGetSetFunc},
{255, "" , 					0 ,		0 ,	0 ,	0 ,	NULL}
};

omci_me_func_t omci_me_tr69_manage_srv_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_tr69_manage_srv_t omci_tr69_manage_srv_attr_data = {0};

omci_attr_t omci_tr69_manage_srv_attr ={
	(uint8_t *)&omci_tr69_manage_srv_attr_data,
	sizeof(omci_tr69_manage_srv_attr_data)
};


/*******************************************************************************************************************************
CUC ONU Capability(Class ID 65457)

********************************************************************************************************************************/

#ifdef TCSUPPORT_CUC
static attribute_func_t CucOnuCapabilityOperatorIDGet = {
	getCucOnuCapOperatorID,
	NULL
};

static attribute_func_t CucOnuCapabilityCucSpecVerGet = {
	getCucOnuCapSpecVer,
	NULL
};

static attribute_func_t CucOnuCapabilityOnuTypeGet = {
	getCucOnuCapOnuType,
	NULL
};

static attribute_func_t CucOnuCapabilityTxPowerCtrlGet = {
	getCucOnuCapOnuTxPowerCtrl,
	NULL
};

omci_attr_dscp_t omci_attr_cuc_onu_cap_op[]={
{0, "meId",				    			2,  ATTR_ACCESS_R,      ATTR_FORMAT_UNSIGNED_INT,    ATTR_FULLY_SUPPORT,	&generalAttrFunc},
{1, "Operator ID",						4,  ATTR_ACCESS_R,      ATTR_FORMAT_STRING,          ATTR_FULLY_SUPPORT,	&CucOnuCapabilityOperatorIDGet},
{2, "CUC Spec Version",					1,  ATTR_ACCESS_R,      ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,	&CucOnuCapabilityCucSpecVerGet},
{3, "ONU Type",		        			1,  ATTR_ACCESS_R,      ATTR_FORMAT_ENUM,            ATTR_FULLY_SUPPORT,	&CucOnuCapabilityOnuTypeGet},
{4, "ONU Tx power supply control",		1,  ATTR_ACCESS_R,  	ATTR_FORMAT_ENUM,   		 ATTR_FULLY_SUPPORT,	&CucOnuCapabilityTxPowerCtrlGet},
{255, "",						0, 0,0,0,NULL}
};

omci_me_func_t omci_me_cuc_onu_cap_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_cuc_onu_cap_t omci_cuc_onu_cap_attr_data = {0};

omci_attr_t omci_cuc_onu_cap_attr ={
	(uint8_t *)&omci_cuc_onu_cap_attr_data,
	sizeof(omci_cuc_onu_cap_attr_data)
};

/*******************************************************************************************************************************
CUC ONU transcever info(Class ID 65458)

********************************************************************************************************************************/
omci_attr_dscp_t omci_attr_cuc_onu_trans_info_op[]={ 
{0, "meId",				    2,	ATTR_ACCESS_R,		ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{1, "Module type",			1,	ATTR_ACCESS_R,	    ATTR_FORMAT_ENUM,			ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{2, "Module sub-type", 	    1,	ATTR_ACCESS_R,		ATTR_FORMAT_ENUM,			ATTR_FULLY_SUPPORT, 	&generalAttrFunc},
{3, "Used type",		    1,	ATTR_ACCESS_R,	    ATTR_FORMAT_ENUM,			ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{4, "Encapsulation Type",	1,	ATTR_ACCESS_R,	    ATTR_FORMAT_ENUM,			ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{5, "Tx wavelength",	    2,	ATTR_ACCESS_R,	    ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{6, "Rx wavelength",	    2,	ATTR_ACCESS_R,	    ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{7, "Vendor name",	        16,	ATTR_ACCESS_R,	    ATTR_FORMAT_STRING,			ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{8, "Vendor PN",	        16,	ATTR_ACCESS_R,	    ATTR_FORMAT_STRING, 		ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{9, "Vendor SN",	        16,	ATTR_ACCESS_R,	    ATTR_FORMAT_STRING,			ATTR_FULLY_SUPPORT,		&generalAttrFunc},
{255, "",					0, 0,0,0,NULL}
};

omci_me_func_t omci_me_cuc_onu_trans_info_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_cuc_onu_trans_info_t omci_cuc_onu_trans_info_attr_data = {0};

omci_attr_t omci_cuc_onu_trans_info_attr ={
	(uint8_t *)&omci_cuc_onu_trans_info_attr_data,
	sizeof(omci_cuc_onu_trans_info_attr_data)
};

#endif

/*ME 247*/
static attribute_func_t ZTEFactoryRestoreDefaultFunc = {
	NULL,
	setZTEFactoryRestoreDefault
};

omci_attr_dscp_t omci_attr_247_op[]={
{0, "meId" ,						2 , ATTR_ACCESS_R,	 ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{1, "unknown attribute 1" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{2, "unknown attribute 2" , 		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{3, "unknown attribute 3" , 		9 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{4, "unknown attribute 4" , 		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{5, "unknown attribute 5" , 		4 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{6, "unknown attribute 6" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{7, "unknown attribute 7" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{8, "unknown attribute 8" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{9, "unknown attribute 9" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{10, "unknown attribute 10" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{11, "unknown attribute 11" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{12, "unknown attribute 12" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{13, "unknown attribute 13" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{14, "unknown attribute 14" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{15, "unknown attribute 15" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{16, "unknown attribute 16" ,		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &ZTEFactoryRestoreDefaultFunc},

{255, "" , 0, 0 , 0, 0 ,NULL}
};
omci_me_func_t omci_me_247_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_reserved_me_247_t omci_me247_attr_data = {0};

omci_attr_t omci_me247_attr ={
	(uint8_t *)&omci_me247_attr_data,
	sizeof(omci_me247_attr_data)
};

/*ME 65408*/
static attribute_func_t huaweiFactoryRestoreDefaultFunc = {
	NULL,
	setHuaweiFactoryRestoreDefault
};
static attribute_func_t huaweiMemOccupFunc = {
	getHuaweiMemOccup,
	NULL
};
static attribute_func_t huaweiCpuOccupFunc = {
	getHuaweiCpuOccup,
	NULL
};
static attribute_func_t huaweiTemperatureFunc = {
	getHuaweiTemperature,
	NULL
};
omci_attr_dscp_t omci_attr_65408_op[]={
{0, "meId" ,						2 , ATTR_ACCESS_R,	 ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{1, "unknown attribute 1" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &huaweiFactoryRestoreDefaultFunc},
{2, "unknown attribute 2" , 		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{3, "memory occupation" , 			1 , ATTR_ACCESS_R, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &huaweiMemOccupFunc},
{4, "cpu occupation" , 				1 , ATTR_ACCESS_R, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &huaweiCpuOccupFunc},
{5, "temperature" , 				2 , ATTR_ACCESS_R, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &huaweiTemperatureFunc},
{6, "unknown attribute 6" , 		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{7, "unknown attribute 7" , 		8 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{8, "unknown attribute 8" , 		4 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{9, "unknown attribute 9" , 		8 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{10, "unknown attribute 10" ,		8 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{11, "unknown attribute 11" ,		8 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{12, "unknown attribute 12" ,		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{13, "unknown attribute 13" ,		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{14, "unknown attribute 14" ,		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{15, "unknown attribute 15" ,		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{16, "unknown attribute 16" ,		2 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},

{255, "" , 0, 0 , 0, 0 ,NULL}
};
omci_me_func_t omci_me_65408_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};

omci_reserved_me_65408_t omci_me65408_attr_data = {0};

omci_attr_t omci_me65408_attr ={
	(uint8_t *)&omci_me65408_attr_data,
	sizeof(omci_me65408_attr_data)
};

static attribute_func_t huaweiWanInfoFunc = {
	getHuaweiWanInfo,
	NULL
};
omci_attr_dscp_t omci_attr_65415_op[]={
{0, "meId" ,						2 , ATTR_ACCESS_R,	 ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{1, "unknown attribute 1" , 		1 , ATTR_ACCESS_R_W, ATTR_FORMAT_UNSIGNED_INT,	ATTR_FULLY_SUPPORT, &generalAttrFunc},
{2, "wan information" , 			1 , ATTR_ACCESS_R,   ATTR_FORMAT_TABLE,			ATTR_FULLY_SUPPORT, &huaweiWanInfoFunc},
{255, "" , 0, 0 , 0, 0 ,NULL}
};
omci_me_func_t omci_me_65415_op ={
	omci_me_general_create_op,
	omci_me_general_delete_op,
	omci_me_general_set_op,
	omci_me_general_get_op,
};
omci_reserved_me_65415_t omci_me65415_attr_data = {0};
omci_attr_t omci_me65415_attr ={
	(uint8_t *)&omci_me65415_attr_data,
	sizeof(omci_me65415_attr_data)
};


/******************************functions*************************************/
int setOLTVendorIdValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_olt_g_ptr olt_g_ptr =NULL;
	char buf[5] = {'\0'};  //vendor id  length is 4
	int ret = 0;
	
	if(me_info==NULL || me_info->attributes == NULL)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	olt_g_ptr = (omci_olt_g_ptr)me_info->attributes;
	
	memcpy(buf,olt_g_ptr->oltVendorId,4);
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:oltVendorId = %s\n", __FUNCTION__,__LINE__,buf);
	ret = omci_adpt_set_commit_attriubte("GPON_OLT", "VendorId", olt_g_ptr->oltVendorId);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return ret=%d\n",__FUNCTION__,__LINE__,ret);	
	return 0;

}

int setOLTEquipmentIdValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_olt_g_ptr olt_g_ptr =NULL;
	char buf[21] = {'\0'};  //equipment id   length is 20
	int ret = 0;
	int i = 0;
	int length = 0;

	if(me_info==NULL || me_info->attributes == NULL)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	olt_g_ptr = (omci_olt_g_ptr)me_info->attributes;
	length = strlen(olt_g_ptr->equipmentId);
	if(0 == length)
		return 0;
	
	while(i < length){
	    if(!isprint(*(olt_g_ptr->equipmentId + i)))
	        return 0;
	    i++;
	}
	memcpy(buf,olt_g_ptr->equipmentId,20);
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:EquipmentId = %s\n", __FUNCTION__,__LINE__,buf);
	ret = omci_adpt_set_commit_attriubte("GPON_OLT", "EquipmentId", olt_g_ptr->equipmentId);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return ret=%d\n",__FUNCTION__,__LINE__,ret);	
	return 0;

}
int setOLTVersionValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_olt_g_ptr olt_g_ptr =NULL;
	char buf[15] = {'\0'};	//equipment id	 length is 20
	int ret = 0;
	int i = 0;
	
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	olt_g_ptr = (omci_olt_g_ptr)me_info->attributes;
    if(0 == strlen(olt_g_ptr->version))
		return 0;
	
	while(0 != olt_g_ptr->version[i] && (i < sizeof(olt_g_ptr->version))){
	    if(!isprint(olt_g_ptr->version[i]))
	        return 0;
	    i++;
	}
	
	memcpy(buf,olt_g_ptr->version,14);
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:version = %s\n", __FUNCTION__,__LINE__,buf);
	ret = omci_adpt_set_commit_attriubte("GPON_OLT", "Version", olt_g_ptr->version);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return ret=%d\n",__FUNCTION__,__LINE__,ret);	
	return 0;

}
int getTimeOfDayValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_olt_g_ptr olt_g_ptr =NULL;
	struct XMCS_GponTodCfg_S pgponTodCfg;
	uint16_t second_H16= 0;
	uint32_t second = 0;
	uint32_t nanosecond = 0;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	olt_g_ptr = (omci_olt_g_ptr)me_info->attributes;


	if(0 != gponmgr_lib_get_current_tod(&pgponTodCfg)){
		return -1;
	}
	second_H16 = pgponTodCfg.sec_H16;
	second = pgponTodCfg.sec;
	nanosecond = pgponTodCfg.nanosec;
	put32((uint8_t *) &olt_g_ptr->timeOfDayInformation[4], second_H16);
	put32((uint8_t *) &olt_g_ptr->timeOfDayInformation[6], second);
	put32((uint8_t *) &olt_g_ptr->timeOfDayInformation[10], nanosecond);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}
int setTimeOfDayValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	struct XMCS_GponTodCfg_S gponTodCfg;
	omci_olt_g_ptr olt_g_ptr =NULL;
	int ret=0;
	char tempBuffer[64] = {0};

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	olt_g_ptr = (omci_olt_g_ptr)me_info->attributes;

	gponTodCfg.superframe= get32((uint8_t*)olt_g_ptr->timeOfDayInformation);
	gponTodCfg.sec_H16= get16((uint8_t*) &olt_g_ptr->timeOfDayInformation[4]);
	gponTodCfg.sec = get32((uint8_t*) &olt_g_ptr->timeOfDayInformation[6]);
	gponTodCfg.nanosec= get32((uint8_t*)&olt_g_ptr->timeOfDayInformation[10]);
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: sec_H16 = %d,sec_L32 = %d,nanosec = %d\n",__FUNCTION__,__LINE__,gponTodCfg.sec_H16,gponTodCfg.sec,gponTodCfg.nanosec);
	ret = gponmgr_lib_set_tod_time(&gponTodCfg);

	snprintf(tempBuffer, 63,"%d, %d, %d, %d", gponTodCfg.superframe,gponTodCfg.sec_H16,gponTodCfg.sec,gponTodCfg.nanosec);
	omci_tcapi_set("GPON_OLT", "ToD", tempBuffer);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return ret=%d\n",__FUNCTION__,__LINE__,ret);
	return ret;
}


#ifdef TCSUPPORT_CUC
int getCucOnuCapOperatorID(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_cuc_onu_cap_ptr cuc_onu_cap_ptr =NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	cuc_onu_cap_ptr = (omci_cuc_onu_cap_ptr)me_info->attributes;	
	memcpy(cuc_onu_cap_ptr->operatorId, "CUC", 4);
	return 0;
}

int getCucOnuCapSpecVer(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_cuc_onu_cap_ptr cuc_onu_cap_ptr =NULL;
    char buf[8];
	int ret=OMCI_GET_NO_VALUE;
    memset(buf, 0, 8);

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	cuc_onu_cap_ptr = (omci_cuc_onu_cap_ptr)me_info->attributes; 
	
    if(0 == omci_tcapi_nget("GPON_ONU", "CucOmciVer", buf,sizeof(buf))){
        buf[7] = 0;
        if(0 == strcmp(buf,"3.0")){
            cuc_onu_cap_ptr->specVer = 0;
			ret = 0;
        }else 
        if(0 == strcmp(buf,"4.0")){
            cuc_onu_cap_ptr->specVer = 1;
			ret = 1;
        }else{
            return OMCI_CMD_ERROR;
        }
    }else{
        return OMCI_CMD_ERROR;
    }

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d, specVer=%d\n",__FUNCTION__,__LINE__,ret,cuc_onu_cap_ptr->specVer);	
    return ret;
}

int getCucOnuCapOnuType(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
    int tmp;
	omci_cuc_onu_cap_ptr cuc_onu_cap_ptr =NULL;
	
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	cuc_onu_cap_ptr = (omci_cuc_onu_cap_ptr)me_info->attributes; 

	if(0 == gponmgr_lib_get_onu_type(&tmp)){
		if(tmp <= 0 || tmp > 2){
			omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] return 0, onuType=%d\n",__FUNCTION__,__LINE__,cuc_onu_cap_ptr->onuType);
			return OMCI_CMD_ERROR;
		}
	}else{
		return OMCI_CMD_ERROR;
	}
	
    cuc_onu_cap_ptr->onuType = tmp - 1;
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return 0, onuType=%d\n",__FUNCTION__,__LINE__,cuc_onu_cap_ptr->onuType);
    return 0;
}

int getCucOnuCapOnuTxPowerCtrl(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_cuc_onu_cap_ptr cuc_onu_cap_ptr =NULL;
	char buf[8];
	int tmp;
	int ret=OMCI_GET_NO_VALUE;
	memset(buf, 0, 8);

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	cuc_onu_cap_ptr = (omci_cuc_onu_cap_ptr)me_info->attributes; 
	
	ret = omci_tcapi_nget("GPON_ONU", "TransceiverPowCtrl", buf,sizeof(buf));
    if(0 == ret){
        buf[7] = 0;
        tmp = atoi(buf);
        
        if(tmp < 0 || tmp > 2){
            return OMCI_CMD_ERROR;
        }
		cuc_onu_cap_ptr->txPwrSupCtrl =(uint8_t)tmp;
    }else{
        return OMCI_CMD_ERROR;
    }

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d, txPwrSupCtrl=%d\n",__FUNCTION__,__LINE__,ret,cuc_onu_cap_ptr->txPwrSupCtrl);	
	return ret;
	
}

#endif

static int setFileTypeValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	int ret=OMCI_GET_NO_VALUE;
	omci_file_transfer_ctrl_ptr file_ctrl_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	file_ctrl_ptr = (omci_file_transfer_ctrl_ptr)me_info->attributes; 
	if (file_ctrl_ptr->fileType == 256)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: software image download\n",__FUNCTION__,__LINE__);
		fileTransferMng.fileType = 1;
		ret = 0;
	}
	else
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]:unknown file type, fileType=%d\n",__FUNCTION__,__LINE__,file_ctrl_ptr->fileType);
	}	
	
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d,\n",__FUNCTION__,__LINE__,ret);	
	return ret;
}
static int setFileInstanceValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	int ret=OMCI_GET_NO_VALUE;
	omci_file_transfer_ctrl_ptr file_ctrl_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	file_ctrl_ptr = (omci_file_transfer_ctrl_ptr)me_info->attributes;  
	if (file_ctrl_ptr->fileInstance == 0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: software image download\n",__FUNCTION__,__LINE__);
		fileTransferMng.fileType = 1;
		ret = 0;
	}
	else
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]:unknown file type, fileInstance=%d\n",__FUNCTION__,__LINE__,file_ctrl_ptr->fileInstance);
	}	
	
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d,\n",__FUNCTION__,__LINE__,ret);	
	return ret;
}
static int setLocalFileNameValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	int ret=OMCI_GET_NO_VALUE;
	uint16_t largeStringMeId = 0;
	uint16_t length = 0;
	char buffer[MAX_STRING_SIZE] = {0};
	omci_file_transfer_ctrl_ptr file_ctrl_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	file_ctrl_ptr = (omci_file_transfer_ctrl_ptr)me_info->attributes;
	
	largeStringMeId = file_ctrl_ptr->localFileNamePointer;
	if (largeStringMeId == 0 || largeStringMeId == 0xFFFF)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:the local File Name is NULL\n",__FUNCTION__,__LINE__);
	}
	else
	{
		if (omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, largeStringMeId, buffer, &length) == 0)
		{
			if(fileTransferMng.localFileName != NULL){
				free(fileTransferMng.localFileName);
				fileTransferMng.localFileName = NULL;
			}
			fileTransferMng.localFileName = malloc(length);
			memcpy(fileTransferMng.localFileName, buffer, length);
			omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: localFileName= %s, length=0x%x\n", __FUNCTION__,__LINE__,fileTransferMng.localFileName, length);
			ret = 0;
		}
		else
		{
			return -1;
		}
	}

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d,\n",__FUNCTION__,__LINE__,ret);	
	return ret;
}
static int setNetworkAddressValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	int ret=OMCI_GET_NO_VALUE;
	uint16_t networkAddressMeId = 0;
	uint16_t length = 0;
	uint16_t largeStringMeId = 0;
	char buffer[MAX_STRING_SIZE] = {0};
	omci_file_transfer_ctrl_ptr file_ctrl_ptr = NULL;
	omci_me_info_t me_info_buf={0};
	omci_network_address_ptr network_addr_ptr=NULL;
	
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	file_ctrl_ptr = (omci_file_transfer_ctrl_ptr)me_info->attributes;  
	
	networkAddressMeId = file_ctrl_ptr->networkAddressPointer;
	if (networkAddressMeId == 0 || networkAddressMeId == 0xFFFF)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:the local File Name is NULL\n",__FUNCTION__,__LINE__);
	}
	else
	{
		//get network address
		me_info_buf.class_id = OMCI_CLASS_ID_NETWORK_ADDRESS;
		me_info_buf.inst_id = networkAddressMeId;
		if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
			omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get attribute fail.\n",__FILE__, __LINE__);
			return -1;
		}
		network_addr_ptr = (omci_network_address_ptr)(me_info_buf.attributes);
		largeStringMeId = network_addr_ptr->addressPointer;
		
		if (omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, largeStringMeId, buffer, &length) == 0)
		{
			if(fileTransferMng.networkAddress != NULL){
				free(fileTransferMng.networkAddress);
				fileTransferMng.networkAddress = NULL;
			}
			fileTransferMng.networkAddress = malloc(length+1);
			memcpy(fileTransferMng.networkAddress, buffer, length);
			omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: networkAddress= %s, length=0x%x\n", __FUNCTION__,__LINE__,fileTransferMng.networkAddress, length);
			ret = 0;
		}
		else
		{
			return -1;
		}
	}

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return ret=%d,\n",__FUNCTION__,__LINE__,ret);	
	return ret;
}
static int setFileTransferTriggerValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{	
	uint8_t fileTransferTrigger = 0;
	char cmdBuffer[128] = {0};
	omci_file_transfer_ctrl_ptr file_ctrl_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	file_ctrl_ptr = (omci_file_transfer_ctrl_ptr)me_info->attributes; 
	fileTransferTrigger = file_ctrl_ptr->fileTransferTrigger;
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: localFileName= %s, networkAddress= %s\n", __FUNCTION__,__LINE__,fileTransferMng.localFileName, fileTransferMng.networkAddress);
	switch (fileTransferTrigger)
	{
		case 1:
			if (fileTransferMng.networkAddress != NULL)
			{
				omci_tcapi_set("OMCI_Entry", "TransferFlag", "1");
				if ( fileTransferMng.localFileName != NULL)
					sprintf(cmdBuffer, "tftp -g -r tclinux.bin -l /tmp/omci/%s %s &", fileTransferMng.localFileName, fileTransferMng.networkAddress);
				else
					sprintf(cmdBuffer, "tftp -g -r tclinux.bin -l /tmp/omci/tclinux.bin %s &",	fileTransferMng.networkAddress);
				omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "cmdBuffer = %s\n", cmdBuffer);
				system(cmdBuffer);
			}
			else
			{
				return -1;
			}
			break;
		case 2:
			if (fileTransferMng.localFileName != NULL)
			{
				omci_tcapi_set("OMCI_Entry", "TransferFlag", "1");
				system("cd /tmp/omci");
				sprintf(cmdBuffer, "tftp -g  -l %s %s &", fileTransferMng.localFileName, fileTransferMng.networkAddress);
				omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "cmdBuffer = %s\n", cmdBuffer);
				system(cmdBuffer);
			}
			else
			{
				return -1;
			}
			break;
		case 3:
			system("killall -9 tftp");
			break;
		case 4:
			system("rm -rf /tmp/omci/tclinux.bin");
			break;
		case 5:
			break;
		default:
			break;
	}

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] return 0,\n",__FUNCTION__,__LINE__);	
	return 0;
}

int getStatusDocumentValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	FILE *fp;
	long fileSize = 0;
	uint32_t tableSize = 0;
	uint8_t* tableBuffer = NULL;
	omci_generic_stat_portal_ptr generic_stat_portal_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	generic_stat_portal_ptr = (omci_generic_stat_portal_ptr)me_info->attributes; 

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: fopen\n",__FUNCTION__,__LINE__);
	fp = fopen("/tmp/omci/cfgDocument.xml", "r");
	if (fp == NULL)
		return -1;
	fseek(fp, 0L, SEEK_END);
	fileSize = ftell(fp);
	if(fileSize <= 0){
		fclose(fp);
		return -1;
	}

	/*1.calculate the table size*/
	tableSize = fileSize;

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: tableSize = %d\n", __FUNCTION__,__LINE__,tableSize);
	/*2.malloc memory for table*/
	tableBuffer = malloc(tableSize);
	if(tableBuffer == NULL){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: malloc fail\n",__FUNCTION__,__LINE__);
		fclose(fp);
		return -1;
	}

	/*3.get  the table copy */
	fseek(fp, 0L, SEEK_SET);
	fileSize = fread(tableBuffer, 1, tableSize, fp);

	fclose(fp);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: tableBuffer = %s\n", __FUNCTION__,__LINE__,tableBuffer);
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]:: tableSize = %d, fileSize = %ld\n",__FUNCTION__,__LINE__, tableSize, fileSize);
	if (fileSize != tableSize)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "fread fail\n");
		free(tableBuffer);
		return -1;
	}

	/*4. copy data  to ouput parameter*/
	if(tableSize > OMCI_MAX_TABLE_SIZE){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: ERROR: tableSize=%d,  exceeding 1024! \n", __FUNCTION__,__LINE__,tableSize);
		tableSize = OMCI_MAX_TABLE_SIZE;
	}
	memcpy(generic_stat_portal_ptr->statDocTable.buf,tableBuffer,tableSize);
	generic_stat_portal_ptr->statDocTable.len = tableSize;
	free(tableBuffer);

	return 0;
}

int getConfugurationdocumentValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	FILE *fp;
	long fileSize = 0;
	uint32_t tableSize = 0;
	uint8_t* tableBuffer = NULL;
	omci_generic_stat_portal_ptr generic_stat_portal_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	generic_stat_portal_ptr = (omci_generic_stat_portal_ptr)me_info->attributes; 

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: fopen\n",__FUNCTION__,__LINE__);
	fp = fopen("/tmp/omci/cfgDocument.xml", "r");
	if (fp == NULL)
		return -1;
	fseek(fp, 0L, SEEK_END);
	fileSize = ftell(fp);
	if(fileSize <= 0){
		fclose(fp);
		return -1;
	}
	
	/*1.calculate the table size*/
	tableSize = fileSize;

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: tableSize = %x\n",__FUNCTION__,__LINE__, tableSize);
	/*2.malloc memory for table*/
	tableBuffer = malloc(tableSize);
	if(tableBuffer == NULL){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: malloc fail\n",__FUNCTION__,__LINE__);
		fclose(fp);
		return -1;
	}

	/*3.get  the table copy */
	fseek(fp, 0L, SEEK_SET);
	fileSize = fread(tableBuffer, 1, tableSize, fp);
	fclose(fp);
	
	if (fileSize != tableSize)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: fread fail\n",__FUNCTION__,__LINE__);
		free(tableBuffer);
		return -1;
	}

	/*4. copy data  to ouput parameter*/
	if(tableSize > OMCI_MAX_TABLE_SIZE){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: ERROR: tableSize=%d,  exceeding 1024!\n", __FUNCTION__,__LINE__,tableSize);
		tableSize = OMCI_MAX_TABLE_SIZE;
	}
	memcpy(generic_stat_portal_ptr->configDocTable.buf,tableBuffer,tableSize);
	generic_stat_portal_ptr->configDocTable.len = tableSize;
	free(tableBuffer);

	return 0;	
}
int setAVCReportRateValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	return omci_adpt_report_event(OMCI_EVENT_AVC_REPORT_RATE, me_info);
}

int omci_me_snmp_cfg_data_create_op(management_entry_ptr me_entry, omci_me_info_ptr me_info)
{
	char EntryName[32]={0};
	if(me_entry == NULL || me_info == NULL){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	/*active SNMP function*/
	memset(EntryName,0, sizeof(EntryName));
	sprintf(EntryName, "Snmpd_Entry");
	omci_tcapi_set(EntryName, "active", "Yes");
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();	

	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}

int omci_me_snmp_cfg_data_delete_op(management_entry_ptr me_entry, omci_me_info_ptr me_info)
{
	char EntryName[32]={0};
	if(me_entry == NULL || me_info == NULL){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	/*deactive SNMP function*/
	memset(EntryName,0, sizeof(EntryName));
	sprintf(EntryName, "Snmpd_Entry");
	omci_tcapi_set(EntryName, "active", "No");
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();	

	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}

int setSnmpReadCommunityValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char EntryName[32]={0};
	char stringBuf[256]={0};
	int ret=0;
	uint16_t stringLength = 0;
	uint16_t instId=0;
	omci_snmp_cfg_data_ptr snmp_cfg_data_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	snmp_cfg_data_ptr = (omci_snmp_cfg_data_ptr)me_info->attributes; 
	instId = snmp_cfg_data_ptr->communityRead;

	/*get string from large string instance*/
	ret = omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, instId, stringBuf, &stringLength);	
	if(ret != 0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get string from instance fail!!!\n",__FUNCTION__,__LINE__);
		return -1;
	}

	/*set the value to SNMP app*/
	memset(EntryName,0, sizeof(EntryName));
	sprintf(EntryName, "Snmpd_Entry");
	omci_tcapi_set(EntryName, "rocommunity", stringBuf);
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();

	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0, communityRead=%d\n",__FUNCTION__,__LINE__,snmp_cfg_data_ptr->communityRead);
	return 0;
}
int setSnmpWriteCommunityValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char EntryName[32]={0};
	char stringBuf[256]={0};
	int ret=0;
	uint16_t instId=0;
	uint16_t stringLength = 0;
	omci_snmp_cfg_data_ptr snmp_cfg_data_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	snmp_cfg_data_ptr = (omci_snmp_cfg_data_ptr)me_info->attributes; 
	instId = snmp_cfg_data_ptr->communityWrite;

	/*get string from large string instance*/
	ret = omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, instId, stringBuf, &stringLength);	
	if(ret != 0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get string from instance fail!!!\n",__FUNCTION__,__LINE__);
		return -1;
	}

	/*set the value to SNMP app*/
	memset(EntryName,0, sizeof(EntryName));
	sprintf(EntryName, "Snmpd_Entry");
	omci_tcapi_set(EntryName, "rwcommunity", stringBuf);
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();	

	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0, communityWrite=%d\n",__FUNCTION__,__LINE__,snmp_cfg_data_ptr->communityWrite);
	return 0;
}

int setSnmpSysNameValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char EntryName[32]={0};
	char stringBuf[256]={0};
	int ret=0;
	uint16_t instId=0;
	uint16_t stringLength = 0;
	omci_snmp_cfg_data_ptr snmp_cfg_data_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	snmp_cfg_data_ptr = (omci_snmp_cfg_data_ptr)me_info->attributes; 
	instId = snmp_cfg_data_ptr->sysNamePointer;

	/*get string from large string instance*/
	ret = omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, instId, stringBuf, &stringLength);	
	if(ret != 0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get string from instance fail!!!\n",__FUNCTION__,__LINE__);
		return -1;
	}

	/*set the value to SNMP app*/
	memset(EntryName,0, sizeof(EntryName));
	sprintf(EntryName, "Snmpd_Entry");
	omci_tcapi_set(EntryName, "sysName", stringBuf);
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();
	
	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0, sysNamePointer=%d\n",__FUNCTION__,__LINE__,snmp_cfg_data_ptr->sysNamePointer);
	return 0;
}

int setLargeStringValue(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
    uint16_t  networkAddressInstList[OMCI_GET_INSTANC_BY_ATTR_MAX_NUM] = {0};
    uint16_t  TR069InstList[OMCI_GET_INSTANC_BY_ATTR_MAX_NUM] = {0};
    uint8_t i = 0;
    uint8_t j = 0;
	int ret=0;
	uint16_t tr069InstId=0;
	uint16_t largeStrInstId=0;
	omci_me_info_t me_info_buf = {0};
	omci_network_address_ptr network_address_ptr = NULL;
	omci_tr69_manage_srv_ptr tr69_manage_srv_ptr = NULL;
	omci_large_string_ptr large_string_ptr =NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	large_string_ptr = (omci_large_string_ptr)me_info->attributes;
	largeStrInstId = large_string_ptr->meId;

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE,"[%s][%d]: Enter, largeStrInstId=%d\n",__FUNCTION__,__LINE__,largeStrInstId);

	ret = omci_lib_get_inst_list_by_classid(OMCI_CLASS_ID_NETWORK_ADDRESS, networkAddressInstList, OMCI_GET_INSTANC_BY_ATTR_MAX_NUM);
	if(ret == -1){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: omci_lib_get_inst_list_by_classid fail!\n",__FUNCTION__,__LINE__);
		return -1;
	}		

    /* config TR-069 address */
    /* get the instance ID of ME:Network address*/
	for (i = 0; i < OMCI_GET_INSTANC_BY_ATTR_MAX_NUM; i++)
    {

		me_info_buf.class_id = OMCI_CLASS_ID_NETWORK_ADDRESS;
		me_info_buf.inst_id = networkAddressInstList[i];
		if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
			omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]omci_attr_get_all_data_except_table_attr failed. i=%d\n",__FUNCTION__,__LINE__,i);
			break;
		}
		network_address_ptr = (omci_network_address_ptr)me_info_buf.attributes;
		if(network_address_ptr->addressPointer != largeStrInstId){
			continue;
		}
		
		tr069InstId = network_address_ptr->meId;

        /*get the instance ID of ME:TR-069 managerment server*/
		ret = omci_lib_get_inst_list_by_classid(OMCI_CLASS_ID_TR069_MANAGE_SERVER, TR069InstList, OMCI_GET_INSTANC_BY_ATTR_MAX_NUM);
		if(ret == -1){
			omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: omci_lib_get_inst_list_by_classid fail!\n",__FUNCTION__,__LINE__);
			return -1;
		}	

     	for (j = 0; j < OMCI_GET_INSTANC_BY_ATTR_MAX_NUM; j++)
        {
			me_info_buf.class_id = OMCI_CLASS_ID_TR069_MANAGE_SERVER;
			me_info_buf.inst_id = TR069InstList[j];
			if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
				omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]omci_attr_get_all_data_except_table_attr failed. j=%d\n",__FUNCTION__,__LINE__,j);
				break;
			}
            /* set new ACS address*/
			tr69_manage_srv_ptr = (omci_tr69_manage_srv_ptr)me_info_buf.attributes;
			if(tr69_manage_srv_ptr->acsNetworkAddress == tr069InstId){
            	setTr069AcsAddr(&me_info_buf,omci_attr_tr69_manage_srv_op);
				omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: setTr069AcsAddr, tr069InstId=%d,j=%d\n",__FUNCTION__,__LINE__,tr069InstId,j);
			}
        }
    }
	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);	
    return 0;
}

int getTr069ManageAdmin(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char buffer[8] = {0};
	omci_tr69_manage_srv_ptr tr69_manage_srv_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	tr69_manage_srv_ptr = (omci_tr69_manage_srv_ptr)me_info->attributes; 
	
	if(omci_tcapi_nget("Cwmp_Entry", "Active", buffer,sizeof(buffer)) != 0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR,"getTr069ManageAdmin: omci_tcapi_get fail!!!\n");
		return -1;
	}

	if(strcmp(buffer, "Yes") == 0)
	{
		tr69_manage_srv_ptr->adminState = 0;
	}
	else
	{
		tr69_manage_srv_ptr->adminState = 1;
	}
	
	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0, adminState=%d\n",__FUNCTION__,__LINE__,tr69_manage_srv_ptr->adminState);
	return 0;
}
int setTr069ManageAdmin(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_tr69_manage_srv_ptr tr69_manage_srv_ptr = NULL;
		
	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	tr69_manage_srv_ptr = (omci_tr69_manage_srv_ptr)me_info->attributes; 

#if/*TCSUPPORT_COMPILE*/ !defined(TCSUPPORT_CT_PON)
	char EntryName[32]={0};
	sprintf(EntryName,"Cwmp_Entry");
	if(tr69_manage_srv_ptr->adminState == 0)
	{
		omci_tcapi_set(EntryName, "Active", "Yes");
	}
	else
	{
		omci_tcapi_set(EntryName, "Active", "No");
	}
	omci_tcapi_commit(EntryName);
	omci_tcapi_save();
#endif/*TCSUPPORT_COMPILE*/

	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: return 0, adminState=%d\n",__FUNCTION__,__LINE__,tr69_manage_srv_ptr->adminState);
	return 0;

}

int setTr069AuthInfo(char* EntryName ,uint16_t instanceId, uint8_t *valueChange)
{
    char userName1[32] = {0};
    char userName2[32] = {0};
    char userName[64] = {0};
    char passWord[32] = {0};
    char realm[32] = {0};
    uint8_t authType = 0;//0:disable 1:md5 3:basic
    char authTypeStr[4] = {0};
    omci_me_info_t me_info_buf={0};
    omci_auth_security_method_ptr auth_security_method_ptr=NULL;
    char strBufold[256] = {0};

    me_info_buf.class_id = OMCI_CLASS_ID_AUTHENTICATION_METHOD;
    me_info_buf.inst_id = instanceId;
    if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
        omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get attribute fail.\n",__FILE__, __LINE__);
        if((instanceId == 0) || (instanceId == 0xFFFF))
            return 0;
        else
            return -1;
    }
    auth_security_method_ptr = (omci_auth_security_method_ptr)(me_info_buf.attributes);
    authType = auth_security_method_ptr->validScheme;	
    sprintf(authTypeStr,"%d",authType);
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---authType = %d\n", __FILE__, __LINE__,authType); 

    memcpy(userName1, auth_security_method_ptr->username1, 25);
    userName1[25] = '\0';
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---userName1 = %s\n",__FILE__, __LINE__,userName1);

    memcpy(userName2, auth_security_method_ptr->username2, 25);
    userName2[25] = '\0';	
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---userName2 = %s\n",__FILE__, __LINE__,userName2);

    if((strlen((char *)userName1) == 25) && (strlen((char *)userName2) != 0))
    {
        sprintf((char *)userName, "%s%s", (char *)userName1, (char *)userName2);
    }
    else
    {
        sprintf((char *)userName, "%s", (char *)userName1);
    }

    memcpy(passWord, auth_security_method_ptr->password, 25);
    passWord[25] = '\0';	
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---passWord = %s\n", __FILE__, __LINE__,passWord);

    memcpy(realm, auth_security_method_ptr->realm, 25);
    realm[25] = '\0';			
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---realm = %s\n", __FILE__, __LINE__,realm);		

    omci_tcapi_nget(EntryName, "acsUserName", (char *)strBufold,sizeof(strBufold));
    if(strcmp(strBufold, userName) != 0)//value change
    {
        omci_tcapi_set(EntryName, "acsUserName", (char *)userName);
        * valueChange = 1;
    }

    omci_tcapi_nget(EntryName, "acsPassword", (char *)strBufold,sizeof(strBufold));
    if(strcmp(strBufold, passWord) != 0)//value change
    {
        omci_tcapi_set(EntryName, "acsPassword", (char *)passWord);
        * valueChange = 1;
    }

    omci_tcapi_nget(EntryName, "authType", (char *)strBufold,sizeof(strBufold));
    if(strcmp(strBufold, authTypeStr) != 0)//value change
    {
        omci_tcapi_set(EntryName, "authType", (char *)authTypeStr);
        * valueChange = 1;
    }

    omci_tcapi_nget(EntryName, "realm", (char *)strBufold,sizeof(strBufold));
    if(strcmp(strBufold, realm) != 0)//value change
    {
        omci_tcapi_set(EntryName, "realm", (char *)realm);
        * valueChange = 1;
    }
    return 0;
}

int setTr069AcsAddr(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
    uint16_t length=0;
    uint8_t buffer[32] = {0};
    uint16_t instanceId=0;
    char EntryName[32] = {0};
    int ret=0;
    char strBuf[256] = {0};
    omci_me_info_t me_info_buf={0};
    omci_network_address_ptr network_addr_ptr=NULL;
    omci_tr69_manage_srv_ptr tr69_manage_srv_ptr = NULL;
    uint8_t valueChange = 0;
    char strBufold[256] = {0};
		
    if(me_info==NULL || me_info->attributes == NULL )
    {
    	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
    	return -1;
    }
    tr69_manage_srv_ptr = (omci_tr69_manage_srv_ptr)me_info->attributes; 


#if/*TCSUPPORT_COMPILE*/ defined(TCSUPPORT_CT_PON_NMG)
    return -1;
#endif/*TCSUPPORT_COMPILE*/

    /*get acs addr from network address instance*/
    me_info_buf.class_id = OMCI_CLASS_ID_NETWORK_ADDRESS;
    me_info_buf.inst_id = tr69_manage_srv_ptr->acsNetworkAddress;
    if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
    	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get attribute fail.\n",__FILE__, __LINE__);
        if(tr69_manage_srv_ptr->acsNetworkAddress == 0 || (tr69_manage_srv_ptr->acsNetworkAddress == 0xFFFF)){
            omci_tcapi_set(EntryName, "acsUrl", (char *)strBuf);
            return omci_adpt_delay_omci_commit_node(EntryName);
    	}
    	return -1;
    }
    network_addr_ptr = (omci_network_address_ptr)(me_info_buf.attributes);
    instanceId = network_addr_ptr->addressPointer;

    //wait for andy's api
    ret = omci_adpt_get_one_string_from_inst(OMCI_CLASS_ID_LARGE_STRING, instanceId, strBuf, &length);
    if(ret != 0)
    {
    	omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: omci_adpt_get_one_string_from_inst fail!\n",__FILE__, __LINE__);
    	return -1;
    }
    omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: ---strBuf = %s\n", __FILE__, __LINE__,strBuf);

    omci_lib_set_rdkb_tr69_url(tr69_manage_srv_ptr->meId,strBuf);

    //get auth information from OMCI_CLASS_ID_AUTHENTICATION_METHOD
    instanceId = network_addr_ptr->securityPointer;
    sprintf(EntryName,"Cwmp_Entry");
    if(omci_tcapi_nget(EntryName, "Active", (char *)buffer,sizeof(buffer)) != 0){
    	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: omci_tcapi_get none Cwmp_Entry! \n",__FUNCTION__,__LINE__);
    	return 0;
    }else{
		if(strcmp((char *)buffer, "Yes") != 0){
    		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: tr069 is not active,but still return success.\n",__FUNCTION__,__LINE__);
    		return 0;
	    }else{
			ret = setTr069AuthInfo(EntryName ,instanceId,&valueChange);
			if(0 != ret){
			    return ret;
		    }
			omci_tcapi_nget(EntryName, "acsUrl", (char *)strBufold,sizeof(strBufold));
		    if(strcmp(strBufold, strBuf) != 0){
		        omci_tcapi_set(EntryName, "acsUrl", (char *)strBuf);
		        valueChange = 1;
		    }
			if( 1 == valueChange){
			    ret = omci_adpt_delay_omci_commit_node(EntryName);
		    }
		}

	}

	return ret;
}
int setTr069AssociateTag(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
#if defined(TCSUPPORT_PON_IP_HOST)
	uint16_t ipHostIstId = 0; /* default ip host config data instance id is 0*/
	omci_tcp_udp_cfg_ptr tcp_udp_cfg_ptr=NULL;
	uint16_t TCP_UDPIstId = 0;
	char value1[10] = {0}, value2[10] = {0};
	uint16_t vlanid_prio = 0, vlanid = 0, prio = 0;
	omci_tr69_manage_srv_ptr tr69_manage_srv_ptr = NULL;
	omci_me_info_t me_info_buf={0};
	omci_veip_ptr veip_ptr=NULL;

	#if/*TCSUPPORT_COMPILE*/ defined(TCSUPPORT_ALPHION_PON)
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] return 0\n",__FUNCTION__,__LINE__);
		return 0;
	#endif/*TCSUPPORT_COMPILE*/
	
	if(me_info==NULL || me_info->attributes == NULL || omci_attr == NULL)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	tr69_manage_srv_ptr = (omci_tr69_manage_srv_ptr)me_info->attributes; 

	vlanid_prio = tr69_manage_srv_ptr->associatedTag;
	vlanid = (vlanid_prio & 0xfff);
	prio = ((vlanid_prio & 0xe000)>>13);
	
    omci_lib_set_rdkb_tr69_associatedTag(tr69_manage_srv_ptr->meId,&vlanid_prio);
	sprintf(value1, "%d", vlanid);
	sprintf(value2, "%d", prio);

	/* TR069 management server --> veip -> TCP/UDP config data -> IPHOST*/
	
	/* get VEIP by TR069 instance id */
	me_info_buf.class_id = OMCI_CLASS_ID_VIRTUAL_ETHERNET_INTERFACE_POINT;
	me_info_buf.inst_id = tr69_manage_srv_ptr->meId;
	if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get attribute fail.\n",__FILE__, __LINE__);
		return 0;
	}
	veip_ptr = (omci_veip_ptr)(me_info_buf.attributes);	

	/* get TCP/UDP config data */
	TCP_UDPIstId =	veip_ptr->tcpUdpPointer;
	me_info_buf.class_id = OMCI_CLASS_ID_TCP_UDP_CFGDATA;
	me_info_buf.inst_id = TCP_UDPIstId;
	if(omci_attr_get_all_data_except_table_attr(&me_info_buf) != 0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: get attribute fail.\n",__FILE__, __LINE__);
		return 0;
	}
#if defined(TCSUPPORT_PON_IP_HOST)
	tcp_udp_cfg_ptr = (omci_tcp_udp_cfg_ptr)me_info_buf.attributes;
	ipHostIstId = tcp_udp_cfg_ptr->ipHostPointer;
	/* update vlanid and dot1p to tr69 wan connection */
	setWanInfo(WAN_IF_TYPE_VLANID, ipHostIstId,value1); /* set vlan id */
	setWanInfo(WAN_IF_TYPE_DOT1P, ipHostIstId,value2); /* set dot1p */
#endif

	if(omci_adpt_delay_omci_commit_node(tr69wan) !=0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d]: addOmciCommitNodeList and start the Timer fail\n",__FUNCTION__,__LINE__);
		return -1;	
	}
#endif

	return 0;
}

int setZTEFactoryRestoreDefault(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_reserved_me_247_ptr me_247_ptr = NULL;
	uint8_t val = 0;
	char buf[128] = {0};

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_247_ptr = (omci_reserved_me_247_ptr)me_info->attributes;
	val = me_247_ptr->vlaue[10];

	if (val == 0x1)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE,"**zte Factory Restore on**\n");
		sprintf(buf, "%d", 2);
		omci_tcapi_set("System_Entry", "reboot_type", buf);
		omci_tcapi_commit("System_Entry");
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE,"**zte Factory Restore done**\n");
	}
	return 0;
}
int setHuaweiFactoryRestoreDefault(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	omci_reserved_me_65408_ptr me_65408_ptr = NULL;
	uint8_t val = 0;
	char buf[128] = {0};

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}

	me_65408_ptr = (omci_reserved_me_65408_ptr)me_info->attributes;
	val = me_65408_ptr->value1;

	if (val == 0x0)
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE,"**Huawei 65408 Factory Restore on**\n");
		sprintf(buf, "%d", 2);
		omci_tcapi_set("System_Entry", "reboot_type", buf);
		omci_tcapi_commit("System_Entry");
		omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE,"**Huawei 65408 Factory Restore done**\n");
	}
	return 0;
}
int getHuaweiMemOccup(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char tempBuffer[MAX_BUFFER_SIZE] = {0};
	omci_reserved_me_65408_ptr me_65408_ptr = NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65408_ptr = (omci_reserved_me_65408_ptr)me_info->attributes;

	if(omci_tcapi_nget("Info_SysDevice","MemoryUsage", tempBuffer,sizeof(tempBuffer)) != 0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] tcapi_nget Info_SysDevice fail\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65408_ptr->memOccup = atoi(tempBuffer);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}
int getHuaweiCpuOccup(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char tempBuffer[MAX_BUFFER_SIZE] = {0};
	omci_reserved_me_65408_ptr me_65408_ptr = NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65408_ptr = (omci_reserved_me_65408_ptr)me_info->attributes;

	if(omci_tcapi_nget("Globalstate_common","CpuUsage", tempBuffer,sizeof(tempBuffer)) != 0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] tcapi_nget Globalstate_common fail\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65408_ptr->cpuOccup = atoi(tempBuffer);

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}
int getHuaweiTemperature(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	PHY_PARAMS_t pPhyTransParams;
	omci_reserved_me_65408_ptr me_65408_ptr = NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65408_ptr = (omci_reserved_me_65408_ptr)me_info->attributes;
	memset(&pPhyTransParams,0,sizeof(PHY_PARAMS_t));
	gponmgr_lib_get_phy_trans_params(&pPhyTransParams);
	me_65408_ptr->temperature = pPhyTransParams.temperature;

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: return 0\n",__FUNCTION__,__LINE__);
	return 0;
}
enum huaweiServiceType{
	HW_SER_TYPE_INTERNET = 0,
	HW_SER_TYPE_TR069,
	HW_SER_TYPE_VOIP,
	HW_SER_TYPE_TR069_INTERNET,
	HW_SER_TYPE_TR069_VOIP,
	HW_SER_TYPE_TR069_VOIP_INTERNET,
	HW_SER_TYPE_VOIP_INTERNET,
	HW_SER_TYPE_IPTV,
	HW_SER_TYPE_OTHER,
	HW_SER_TYPE_MAX
};
enum huaweiconnectType{
	HW_CON_TYPE_IP_BR = 0,
	HW_CON_TYPE_IP_ROUTE,
	HW_CON_TYPE_PPP_BR,
	HW_CON_TYPE_MAX
};
enum huaweiconnectStatus{
	HW_CON_STAT_CONNECTING = 1,
	HW_CON_STAT_CONNECTED,
	HW_CON_STAT_DISCONNECTED = 5,
	HW_CON_STAT_MAX
};
enum huaweiIpType{
	HW_IP_TYPE_INVALID = 0,
	HW_IP_TYPE_DHCP,
	HW_IP_TYPE_STATIC,
	HW_IP_TYPE_PPPOE,
	HW_IP_TYPE_MAX
};
enum huaweiOption6{
	HW_OPTION_6_NO = 0,
	HW_OPTION_6_YES,
	HW_OPTION_6_MAX
};
/*Huawei ME 68415 attribute 2, 52bytes for each wan.*/
typedef struct {
	char index;
	char name[32];
	char serviceType;
	char connectType;
	char connectStatus;
	char ipAccType;
	char ip[4];
	char mask[4];
	char gateWay[4];
	char tag[2];
	char ipv6;
}HUAWEIWANINFO_t;

int getHuaweiWanInfo(omci_me_info_ptr me_info, omci_attr_dscp_ptr omci_attr)
{
	char *tableBuffer = NULL;
	int tableSize = 0;
	uint16_t wanNum = 0;
	uint16_t vtag = 0;
	HUAWEIWANINFO_t wanInfo[64];
	HUAWEIWANINFO_t *wanPtr;
	int i = 0,j = 0,k = 0;
	int infoIndex = 0;
	int tmpVal[4] = {0};
	char pvcNodeName[MAX_BUFFER_SIZE] = {0};
	char infoNodeName[MAX_BUFFER_SIZE] = {0};
	char buffer[MAX_BUFFER_SIZE] = {0};
	omci_reserved_me_65415_ptr me_65415_ptr = NULL;

	if(me_info==NULL || me_info->attributes == NULL )
	{
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "[%s][%d] input paramter pointer is NULL\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65415_ptr = (omci_reserved_me_65415_ptr)me_info->attributes;
	tableBuffer = me_65415_ptr->wanInfoTable.buf;
	if(tableBuffer == NULL){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "%s [%d]->attribute table buf is NULL, failure\n",__FUNCTION__,__LINE__);
		return -1;
	}
	for(i=0; i<8; i++){
		for(j=0; j<8; j++){
			infoIndex = 8*i+j;
			sprintf(pvcNodeName, "WAN_PVC%d_Entry%d", i, j);
			sprintf(infoNodeName, "WanInfo_Entry%d", infoIndex);
			/*Get WAN Connection Status*/
			if(omci_tcapi_nget(infoNodeName,"Status", buffer,sizeof(buffer)) != 0){
				omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d] WAN Info Entry %d doesn't exsit!\n",__FUNCTION__,__LINE__,infoIndex);
				continue;
			}
			wanPtr = &wanInfo[wanNum];
			wanNum ++;
			wanPtr->index = wanNum;
			if(strcmp(buffer,"up") == 0){
				wanPtr->connectStatus = HW_CON_STAT_CONNECTED;
			}else if(strcmp(buffer,"down") == 0){
				wanPtr->connectStatus = HW_CON_STAT_CONNECTING;
			}else{
				wanPtr->connectStatus = HW_CON_STAT_DISCONNECTED;
			}
			/*Get WAN Name*/
			omci_tcapi_nget(infoNodeName,"GUIInterfaceName", buffer,sizeof(buffer));
			memcpy(wanPtr->name,buffer,sizeof(wanPtr->name));
			/*Get WAN Service Type*/
			omci_tcapi_nget(pvcNodeName,"ServiceList", buffer,sizeof(buffer));
			if(strcmp(buffer,"INTERNET") == 0){
				wanPtr->serviceType = HW_SER_TYPE_INTERNET;
			}else if(strcmp(buffer,"TR069") == 0){
				wanPtr->serviceType = HW_SER_TYPE_TR069;
			}else if(strcmp(buffer,"TR069_INTERNET") == 0){
				wanPtr->serviceType = HW_SER_TYPE_TR069_INTERNET;
			}else if(strcmp(buffer,"TR069_VOICE") == 0){
				wanPtr->serviceType = HW_SER_TYPE_TR069_VOIP;
			}else if(strcmp(buffer,"VOICE") == 0){
				wanPtr->serviceType = HW_SER_TYPE_VOIP;
			}else if(strcmp(buffer,"TR069_VOICE_INTERNET") == 0){
				wanPtr->serviceType = HW_SER_TYPE_TR069_VOIP_INTERNET;
			}else if(strcmp(buffer,"VOICE_INTERNET") == 0){
				wanPtr->serviceType = HW_SER_TYPE_VOIP_INTERNET;
			}else if(strcmp(buffer,"OTHER") == 0){
				wanPtr->serviceType = HW_SER_TYPE_OTHER;
			}else{
				wanPtr->serviceType = HW_SER_TYPE_IPTV;
			}
			/*Get WAN Connection Type*/
			omci_tcapi_nget(pvcNodeName,"WanMode", buffer,sizeof(buffer));
			if(strcmp(buffer,"Bridge") == 0){
				omci_tcapi_nget(pvcNodeName,"LinkMode", buffer,sizeof(buffer));
				if(strcmp(buffer,"linkIP") == 0){
					wanPtr->connectType = HW_CON_TYPE_IP_BR;
				}else if(strcmp(buffer,"linkPPP") == 0){
					wanPtr->connectType = HW_CON_TYPE_PPP_BR;
				}
				wanPtr->ipAccType = HW_IP_TYPE_INVALID;
			}else if(strcmp(buffer,"Route") == 0){
				wanPtr->connectType = HW_CON_TYPE_IP_ROUTE;
				/*Get WAN IP Access Type*/
				omci_tcapi_nget(pvcNodeName,"ISP", buffer,sizeof(buffer));
				if(strcmp(buffer,"0") == 0){
					wanPtr->ipAccType = HW_IP_TYPE_DHCP;
				}else if(strcmp(buffer,"1") == 0){
					wanPtr->ipAccType = HW_IP_TYPE_STATIC;
				}else if(strcmp(buffer,"2") == 0){
					wanPtr->ipAccType = HW_IP_TYPE_PPPOE;
				}
			}
			/*Get WAN IP*/
			omci_tcapi_nget(infoNodeName,"IP", buffer,sizeof(buffer));
			sscanf(buffer,"%d.%d.%d.%d",&tmpVal[0],&tmpVal[1],&tmpVal[2],&tmpVal[3]);
			for(k=0; k<4; k++){
				wanPtr->ip[k] = (char)tmpVal[k];
			}
			/*Get WAN NetMask*/
			omci_tcapi_nget(infoNodeName,"NetMask", buffer,sizeof(buffer));
			sscanf(buffer,"%d.%d.%d.%d",&tmpVal[0],&tmpVal[1],&tmpVal[2],&tmpVal[3]);
			for(k=0; k<4; k++){
				wanPtr->mask[k] = (char)tmpVal[k];
			}
			/*Get WAN Defailt GateWay*/
			omci_tcapi_nget(infoNodeName,"GateWay", buffer,sizeof(buffer));
			sscanf(buffer,"%d.%d.%d.%d",&tmpVal[0],&tmpVal[1],&tmpVal[2],&tmpVal[3]);
			for(k=0; k<4; k++){
				wanPtr->gateWay[k] = (char)tmpVal[k];
			}
			/*Get WAN Priority*/
			omci_tcapi_nget(pvcNodeName,"dot1pData", buffer,sizeof(buffer));
			vtag = ((uint16_t)atoi(buffer) << 13);

			/*Get WAN VLAN*/
			omci_tcapi_nget(pvcNodeName,"VLANID", buffer,sizeof(buffer));
			vtag |= (uint16_t)atoi(buffer);
			put16((uint8_t *)wanPtr->tag, vtag);

			/*Get WAN IP Version*/
			omci_tcapi_nget(pvcNodeName,"IPVERSION", buffer,sizeof(buffer));
			if(strcmp(buffer,"IPv4") == 0){
				wanPtr->ipv6 = HW_OPTION_6_NO;
			}else{
				wanPtr->ipv6 = HW_OPTION_6_YES;
			}
		}
	}

	tableSize = wanNum*52 + 2;
	if(me_65415_ptr->wanInfoTable.len < tableSize || tableSize < 0){
		omcidbgPrintf(OMCI_DEBUG_LEVEL_ERROR, "%s [%d]->attribute table size is not enough, failure\n",__FUNCTION__,__LINE__);
		return -1;
	}
	me_65415_ptr->wanInfoTable.len = tableSize;
	memset(tableBuffer, 0, me_65415_ptr->wanInfoTable.len);	
	put16((uint8_t*)tableBuffer , wanNum);
	for(i=0; i<wanNum; i++){
		memcpy(tableBuffer + 2 + 52*i,&wanInfo[i],sizeof(HUAWEIWANINFO_t));
	}

	omcidbgPrintf(OMCI_DEBUG_LEVEL_TRACE, "[%s][%d]: wanNum = %d, tableSize = %d !\n",__FUNCTION__,__LINE__,wanNum,me_65415_ptr->wanInfoTable.len);
	return 0;
}

